package com.rc.saas.mini.service.platform;

import com.rc.saas.mini.mapper.platform.PlatformCityMapper;
import com.rc.saas.mini.model.platform.PlatformCity;
import com.rc.saas.mini.model.platform.PlatformCityExample;
import com.rc.saas.mini.search.PlatformCitySearch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class PlatformCityServiceImpl implements PlatformCityService {

    @Autowired
    private PlatformCityMapper platformCityMapper;
    @Override
    public PlatformCityMapper getMapper() {
        return platformCityMapper;
    }

    @Override
    public PlatformCity selectByCityName(String cityName) {
        List<PlatformCity> platformCities=new ArrayList<>();
        PlatformCityExample example = new PlatformCityExample();
        example.createCriteria().andCityNameEqualTo(cityName);
       return platformCityMapper.selectByExample(example).stream().findFirst().orElseGet(()->null);
    }

    //@Override
    //public List <PlatformCity> selectCityByElecGroups(PlatformCitySearch search) {
    //    List <PlatformCity> cities =  platformCityMapper.selectCityByElecGroups(search);
    //    return cities;
    //}
}
